package com.itboye.mengwu.data.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.object.BasePresenter;
import com.itboye.core.object.ResultEntity;
import com.itboye.mengwu.app.ui.main.MainPresenter;
import com.itboye.mengwu.data.interfaces.IAddGoods;
import com.itboye.mengwu.data.interfaces.IMomZeng;
import com.itboye.mengwu.data.model.GoodsListModel;
import com.itboye.mengwu.data.model.MomZengBean;
import com.itboye.mengwu.data.repository.AddGoodsRepository;
import com.itboye.mengwu.data.repository.MomZengRespository;

public class MomZengPresenter extends BasePresenter implements
		IMomZeng<MomZengBean> {
	public static final String Collection_success = MainPresenter.class
			.getName() + "_Collection_success";
	public static final String Collection_fail = MainPresenter.class.getName()
			+ "_Collection_fail";
	public static final String CancleCollection_success = MainPresenter.class
			.getName() + "_CancleCollection_success";
	public static final String CancleCollection_fail = MainPresenter.class
			.getName() + "_CancleCollection_fail";

	public MomZengPresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(MomZengBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(MomZengBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(MomZengBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(MomZengBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public List<MomZengBean> query(MomZengBean model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void collection(String tid, String uid, String favorite_value) {
		// TODO Auto-generated method stub
		IMomZeng<MomZengBean> momZeng = new MomZengRespository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(Collection_success);
						MomZengPresenter.this.setChanged();
						MomZengPresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(Collection_fail);
						MomZengPresenter.this.setChanged();
						MomZengPresenter.this.notifyObservers(result);

					}
				});
		momZeng.collection(tid, uid, favorite_value);
	}

	@Override
	public void cancleCollection(String tid, String uid, String favorite_value) {
		// TODO Auto-generated method stub
		IMomZeng<MomZengBean> momZeng = new MomZengRespository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(CancleCollection_success);
						MomZengPresenter.this.setChanged();
						MomZengPresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(CancleCollection_fail);
						MomZengPresenter.this.setChanged();
						MomZengPresenter.this.notifyObservers(result);

					}
				});
		momZeng.collection(tid, uid, favorite_value);

	}

}
